package com.nmgolden.lanxin;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author siger
 * @created 2022/7/9
 * @updated 2022/7/9
 */
@Configuration
@ConditionalOnMissingBean(LanxinService.class)
public class LanxinAutoConfiguration {

    @Bean
    @ConfigurationProperties("lanxin")
    public LanxinAppConfig lanxinAppConfig() {
        return new LanxinAppConfig();
    }

    @Bean
    public LanxinService lanxinService(LanxinAppConfig lanxinAppConfig) {
        return new DefaultLanxinService(lanxinAppConfig);
    }
}
